#include "front/text_normalize.h"

using namespace std;
using namespace ppspeech;

const map<wchar_t, wstring> MapWcharWstr_ZhReplaceSymbol = {
	{L'+', L"加"},
	{L'×', L"乘"},
	{L'÷', L"除以"},
	{L'=', L"等于"},

	{L'℃', L"摄氏度"},	{L'℉', L"华氏度"},
//	{L'*', L"星"},
	{L'#', L"井"},		{L'&', L"与"},		{L'|', L"或"},

//	{L'√', L"勾"},		{L'×', L"叉"},

	{L'$', L"美元"},	{L'￥', L"元"},	{L'£', L"欧元"},	{L'@', L"at"}
};


const map<wchar_t, wstring> MapWcharWstr_EnReplaceSymbol = {
	{L'+', L"plus"},		//减法minus
	{L'×', L"times"},
	{L'÷', L"divided by"},
	{L'=', L"equals"},

	{L'℃', L"centigrade"},		{L'℉', L"fahrenheit degree"},		//{L'°C', L"centigrade"},
//	{L'*', L"star"},
	{L'#', L"hash"},	{L'&', L"and"},			{L'|', L"or"},

//	{L'√', L"tick"},	{L'×', L"cross"},

	{L'$', L"dollar"},	{L'￥', L"yuan"},	{L'£', L"euro"},	{L'@', L"at"}
};


void TextNormalizer::TnReFinallySymbol(wstring* fpInWsentence, const LanguageEnum fcInLanguage)
{
	wstring tWstrResult = L"";
	const auto tcMapReplaceSymbol = (fcInLanguage==LANG_EN) ? MapWcharWstr_EnReplaceSymbol : MapWcharWstr_ZhReplaceSymbol;

	for(const wchar_t& tcWchar : (*fpInWsentence)) {
		const auto tcIterator = tcMapReplaceSymbol.find(tcWchar);
		if(tcMapReplaceSymbol.end() != tcIterator) {
			tWstrResult += (fcInLanguage==LANG_EN) ? L" " : L"";
			tWstrResult += tcIterator->second;
			tWstrResult += L"，";
		}
		else {
			tWstrResult += tcWchar;
		}
	}

	(*fpInWsentence) = tWstrResult;
}
